<template>
    <div class="login-wrap">
        <el-form
            class="login-form"
            label-position="top"
            label-width="80px"
            :model="formdata"
        >
            <h2>用户登陆</h2>
            <el-form-item label="用户名">
                <el-input v-model="formdata.username"></el-input>
            </el-form-item>
            <el-form-item label="密码">
                <el-input v-model="formdata.password"></el-input>
            </el-form-item>
            <el-button @click="handleLogin" class="login-btn" type="primary"
                >登陆</el-button
            >
        </el-form>
    </div>
</template>
<script>
export default {
    data() {
        return {
            formdata: {
                username: "",
                password: "",
            },
        };
    },
    methods: {
        //登陆请求
        handleLogin() {
            localStorage.setItem("token", "123456");

            this.$router.push({ name: "users" });
            this.$message.success("登陆成功");
        },
    },
};
</script>
<style >
.login-wrap {
    height: 100%;
    background-color: #324152;
    display: flex;
    justify-content: center;
    align-items: center;
}
.login-wrap .login-form {
    width: 400px;
    background-color: #fff;
    border-radius: 5px;
    padding: 30px;
}
.login-wrap .login-btn {
    width: 100%;
}
</style>